<?php
require("../inc/common.inc.php");
require("checkLogin.php");
$web_title="修改密码";
$table = 'mx_app_user';
$info = $db->getinfo("select * from $table where id=$mxuserid");
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta content="width=device-width,user-scalable=no,initial-scale=1,maximum-scale=1" name="viewport">
<title><?php echo $web_title?></title>
<meta name="searchtitle" content="<?php echo $webdb['description'];?>">
<meta name="description" content="<?php echo $webdb['description'];?>">
<meta name="keywords" content="<?php echo $webdb['metakeywords'];?>">
<meta content="application/xhtml+xml;charset=UTF-8" http-equiv="Content-Type">
<meta content="no-cache,must-revalidate" http-equiv="Cache-Control">
<meta content="no-cache" http-equiv="pragma">
<meta content="0" http-equiv="expires">
<meta content="telephone=no, address=no" name="format-detection">
<meta content="width=device-width, initial-scale=1.0" name="viewport">
<meta name="apple-mobile-web-app-capable" content="yes" /> <!-- apple devices fullscreen -->
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<?php 
if($actions=="modifsave"){
	if(trim($old_password)==""){
		$fun->popmassage("旧密码不能为空！","","popback");
		exit();
	}
	if($password==""){
		$fun->popmassage("新密码不能为空！","","popback");
		exit();
	}
	if($re_password != $password){
		$fun->popmassage("两次密码不一致！","","popback");
		exit();
	}
	if($info['password'] != md5($old_password)){
		$fun->popmassage("旧密码错误！","","popback");
		exit();
	}

	$update_fields['password'] = md5($re_password);
	$db->exe_update($table, $update_fields,"id=$mxuserid");
	echo "<script>alert('修改成功！');location.href='/user/index.php';</script>";
	exit();
}
$head_hide=1;require("../w_head.php")?>
<style>
#hyzl .width40 {
    line-height: 50px;
    width: 50px;
}
</style>
</head>
<body>
<div id="ly_yifeng">修改密码</div>

<div class="list_ban"><img src="/images/p2.jpg" />
  <div class="list_bana">
<!--    <div class="list_bana_l"><img src="/images/31.jpg" /><div class="list_bana_la">   &nbsp;</div></div> -->
   <div class="list_bana_r">
    <dl class="list_bana_ra"><dt><?php echo $info['realname'];?>，欢迎您!</dt><!-- <dt>会员等级:<b style="color:#f30;">&nbsp;A类会员</b></dt> --></dl> 
	<dl class="list_bana_rb"><dt>余额：￥<?php echo $info['money']?></dt></dl> 
	<dl class="list_bana_rb"><dt>积分：<?php echo $info['integral']?></dt></dl>
   </div>
  </div>
 </div>
 
 <!--dan-->
<div class="member_2">
	<div id="hyzl">
	<h1>
    	<div class="l"><img src="/images/user_36.png" /></div>
        <div class="c">修改密码</div>
    </h1>
    <form id="form1" name="form1" method="post" action="modifPwd.php?actions=modifsave">
    <ul>
      <table width="90%" height="178" border="0" align="center" cellpadding="10" cellspacing="0">
        <tr>
        <td class="width40">姓名</td>
          <td><?php echo $info['realname']?>&nbsp;&nbsp;(<font color="red">不可更改</font>)</td>
        </tr>
          <td class="width40">手机</td>
          <td><?php echo $info['mobile']?>&nbsp;&nbsp;(<font color="red">不可更改</font>)</td>
        </tr>
        <tr>
          <td class="width40">旧密码</td>
          <td><input type="password" name="old_password" value="" id="old_password" class="input1" /></td>
        </tr>
        <tr>
          <td class="width40">新密码</td>
          <td><input type="password" name="password" value="" id="password" class="input1" /></td>
        </tr>
        <tr>
          <td class="width40">确认密码</td>
          <td><input type="password" name="re_password" value="" id="re_password" class="input1" /></td>
        </tr>
      </table>
      <div class="input2"><a href="javascript:void(0);" onclick="check_from();">确认修改</a></div>
    </ul>
  </form>
</div>
<script>
	function check_from(){
		var oldpassword = $('#old_password').val();
		if(oldpassword==""){
			alert("旧密码不能为空！")
			return false;
		}
		var password = $("#password").val();
		if(password==""){
			alert("新密码不能为空！");
			return false;
		}
		var re_password = $("#re_password").val();
		if(re_password != password){
			alert("两次密码不一致");
			return false;
		}
		$("#form1").submit();
	}
</script>
</div>
 <!--dan-->
<div class="clear"></div>
<?php require("../w_foot.php")?>